package LanQiao.jichu;

import java.util.Scanner;

//特殊回文数
public class BASIC_9 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 10000; i < 1000000; i++) {
            if (isHu(i)) {
                int sum = 0;
                int x = i;
                while (x != 0) {
                    sum+=x%10;
                    x/=10;
                }
                if (sum == n) {
                    System.out.println(i);
                }
            }
        }
    }

    public static boolean isHu(int num) {
        String s = Integer.toString(num);
        int prev = 0,tail = s.length() - 1;
        while (prev < tail) {
            if (s.charAt(prev) != s.charAt(tail)) {
                return false;
            }
            prev++;
            tail--;
        }
        return true;
    }
}
